package com.ayf.payment.game.api.controller.ehb;

import com.ayf.payment.game.api.dto.MerchantDTO;
import com.ayf.payment.game.api.dto.ayb.SignPayProductDTO;
import com.ayf.payment.game.api.dto.ayf.AyfSplitOrderBindDTO;
import com.ayf.payment.game.api.service.ehb.EhbSplitOrderBindService;
import com.ayf.payment.game.api.type.CommonConstants;
import com.ayf.payment.game.api.utils.CommonResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/v/ehb/splitorderbind")
@RestController
public class EhbSplitOrderBindController {

    @Resource
    private EhbSplitOrderBindService ehbSplitOrderBindService;


    /**
     * 获取分账通分账绑定信息
     * @author lch
     * @date 2021/12/9
     */
    @PostMapping("/getBindResult")
    public CommonResult<?> getBindResult(MerchantDTO merchantDTO) {
        SignPayProductDTO payProductDTO =  this.ehbSplitOrderBindService.getBindResult(merchantDTO);
        return new CommonResult(CommonConstants.RETURN_SUCCESS, "成功", payProductDTO);
    }

    /**
     * 绑定分账通分账
     * @author lch
     * @date 2021/12/9
     */
    @PostMapping("/bind")
    public CommonResult<?> bind(MerchantDTO merchantDTO, @RequestBody AyfSplitOrderBindDTO dto) {
		this.ehbSplitOrderBindService.bind(merchantDTO, dto);
		return new CommonResult(CommonConstants.RETURN_SUCCESS, "成功", true);
    }

    /**
     * 解绑分账通分账
     * @author lch
     * @date 2021/12/9
     */
    @PostMapping("/unBind")
    public CommonResult<?> unBind(MerchantDTO merchantDTO) {
        this.ehbSplitOrderBindService.unBind(merchantDTO);
        return new CommonResult(CommonConstants.RETURN_SUCCESS, "成功", true);
    }

}
